<template name="my-tabbar">
	<u-tabbar
		:value="fullPath"
		:fixed="true"
		:placeholder="true"
		:safeAreaInsetBottom="true"
		zIndex="99"
		:activeColor="tabbar.active_color"
	>
		<u-tabbar-item :name="item.path" :text="item.name" v-for="(item,index) in tabbar.list" :key="index" @click="$c.a(item.path,item.data,item.type)">
			<image class="tabbar_icon_img" slot="inactive-icon" :src="item.inactive"></image>
			<image class="tabbar_icon_img" slot="active-icon" :src="item.active"></image>
		</u-tabbar-item>
	</u-tabbar>
</template>

<script>
    export default {
		name:"my-tabbar",
        props: {
            tab:{
                type: [String],
                default:''
            },
            back: {
                type: [Boolean],
                default: true
            }
        },
		data(){
			return{
				fullPath:'',				//当前页面URL
				tabbar:{
					active_color:"#7d7e80",
					list:[
						{
							name:"租车",
							inactive:"/static/tabbar/home.png",
							active:"/static/tabbar/home-active.png",
							path:"/pages/index/index",
							data:{},
							type:2,
						},
						{
							name:"订单",
							inactive:"/static/tabbar/order.png",
							active:"/static/tabbar/order-active.png",
							path:"/pages/index/order",
							data:{i:'index'},
							type:2,
						},
						{
							name:"我的",
							inactive:"/static/tabbar/user.png",
							active:"/static/tabbar/user-active.png",
							path:"/pages/index/user",
							data:{},
							type:2,
						}
					]
				}
			}
		},
		computed:{
			tab_index(){
				return this.tab
			}
		},
		onReady(){
			let pages = getCurrentPages(); // 获取当前打开过的页面路由数组
			// console.log(pages);
			let fullPath = pages[pages.length - 1].$page.fullPath;
			this.fullPath = fullPath;
		},
        methods: {
        }
    }
</script>

<style class="scss">
	.tabbar_icon_img{
		width: 24px;
		height: 24px;
	}
</style>